using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Parser;
using System.Text.RegularExpressions;
using Index.Pages;
using Parser.Terms;
using System.IO;
using System.Diagnostics;
using TermPreprocessor;

namespace ParserTest
{
    class Program
    {
        static void Main(string[] args)
        {
			string wikiRoot = @"E:\Wiki\wikipedia-pl-html\pl\p\r";
			//string wikiRoot = @"E:\Wiki\wikipedia-pl-html\";
			
			WikiPagesCollection pages = new WikiPagesCollection(wikiRoot);
			Steamer steamer = new Steamer(@"E:\Materialy\Wyszukiwanie w siechach WWW\WikiSearchEngine\morfologik-1-2\morfologikParsed.txt");

			Console.WriteLine(pages.Pages.Length);

			StreamWriter sw = new StreamWriter("parse.txt");

            HTMLParser parser = new HTMLParser("...");

			for (int i = 0; i < pages.Pages.Length; i++)
			{
				Console.WriteLine(wikiRoot+ pages.Pages[i]);

				HTMLParserResult result = parser.parseDocument(wikiRoot + pages.Pages[i]);
				//HTMLParserResult result = HTMLParser.parseDocument(@"E:\Wiki\wikipedia-pl-html\pl\k\a\m\Dyskusja_Wikipedysty~Kamamur_9a5e.html");

				if (result != null)
				{
					foreach (Word w in result.Words)
					{
						sw.WriteLine(w.Text);
						//Console.WriteLine(w.Text);
					}

					foreach (Link l in result.Links)
					{
						//sw.WriteLine(l);
						//Console.WriteLine(l);
					}
				}
			}

			sw.Close();
		}
	}
}
